<!DOCTYPE html>
<html>
<body>

<p id="demo">Click the button to display the array value after the split.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction()
{
var output = [];
var str="[AA, 1],[BB, 2],[CC, 3]";
var n=str.split("],");
console.log("n");
console.log(n);
console.log("TMP")
for (var i in n)
{
    var tmp = n[i].split(",");
	var first = tmp[0].split('[')[1];
	console.log([first, tmp[1]]);
	output.push([first, tmp[1]]);

}
console.log("output");
console.log(output);
}
</script>

</body>
</html>
